package com.baidu.Chapter01;

public class ex1_7 {
    public static void main(String[] args) {
        float b=1,c,d=3,sum=0;
        for (int i = 0; i < 5; i++) {
            b=-b;
            c=b/d;
            d=d+2;
            sum=sum+c;
        }
        System.out.println(4*(1+sum));
        b=1;
        c=0;
        d=3;
        sum=0;
        for (int i = 0; i < 6; i++) {
            b=-b;
            c=b/d;
            d=d+2;
            sum=sum+c;
        }
        System.out.println(4*(1+sum));
    }
}
